<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>列表渲染</title>
    <script src="./vue.js"></script>
</head>
<body>

<!--
v-for
-->

<div id="app">
    <ul>
        <li v-for="item in list" :key="item.id">
            {{item.name}}
        </li>
    </ul>
    <ol>
        <li v-for="(item,index) in list" :key="index">
            {{item.id}}:{{item.name}}:{{index}}
        </li>
    </ol>
</div>

<script>
    let vm = new Vue({
        el: '#app',
        data: {
            list: []
        },
        created() {
            for (let i = 1; i <= 5; i++) {
                this.list.push({
                    id: i,
                    name: `jack-${i}`
                })
            }
        }
    })
</script>

</body>
</html>